let data = {
  name: "后盾人",
  user: {
    name: "hdcms"
  }
};
function copy(object) {
  let res = {};
  for (const key in object) {
    //递归调用实现深拷贝
    res[key] = typeof object[key] == "object" ? copy(object[key]) : object[key];
  }
  return res;
}
let hd = copy(data);
hd.user.name = "败军";
console.log(JSON.stringify(hd, null, 2));
console.log(JSON.stringify(data, null, 2));
